package com.hejl.controller;

import org.springframework.ai.ollama.OllamaChatModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Hejl
 * @version 1.0
 * @description
 * @className OllamaController
 * @date 2025/6/11 1:55
 */
@RestController
@RequestMapping("/ai")
public class OllamaController {
    @Autowired
    private OllamaChatModel ollamaChatModel;

    @RequestMapping("/chat")
    public String ollama(@RequestParam("prompt") String prompt,
                         @RequestParam("chatId") String chatId) {
        String result = ollamaChatModel.call(prompt);
        return result;
    }
}